package com.kgc.service.Impl;

import com.kgc.dao.mapper.ActivitiesMapper;
import com.kgc.entity.Activities;
import com.kgc.service.interf.ActivitiesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@Service
public class ActivitiesServiceImpl implements ActivitiesService {
    @Autowired
    private ActivitiesMapper activitiesMapper;

    /**
     * 添加活动
     * @param activities
     * @return
     */
    @Override
    public int addAction(Activities activities) {
        return activitiesMapper.addAction(activities);
    }

    /**
     * 删除活动
     * @param activityID
     * @return
     */
    @Override
    public int deleteAction(Integer activityID) {
        return activitiesMapper.deleteAction(activityID);
    }

    /**
     * 更新活动
     * @param
     * @return
     */
    @Override
    public int updateAction(Activities activities) {
        return activitiesMapper.updateAction(activities);
    }


    /**
     * 获取所有活动
     * @return
     */
    @Override
    public List<Activities> getAllActivities() {
        return activitiesMapper.getAllActivities();
    }


    /**
     * 用户报名
     * @return
     */
    @Override
    public int userSignUp(Integer activityId, String userPhone, Integer userId) {
        return activitiesMapper.userSignUp(activityId,userPhone,userId);
    }

    /**
     * 获取已结束活动
     * @return
     */
    @Override
    public List<Activities> getEndActivities() {
        return activitiesMapper.getEndActivities();
    }

    /**
     * 获取未开始的活动
     * @return
     */
    @Override
    public List<Activities> getStartActivities() {
        return activitiesMapper.getStartActivities();
    }


    /**
     * 获取用户报名的活动
     * @return
     */
    @Override
    public List<Activities> getUserSignUpActivities(Integer userId) {
        return activitiesMapper.getUserSignUpActivities(userId);
    }

    @Override
    public List<Activities> getAllActivities1() {
        return activitiesMapper.getAllActivities1();
    }
}
